import { IToolTipItem } from "../../../../com/mui/manager/IToolTipItem";
import { ToolTipsManager } from "../../../../com/mui/manager/ToolTipsManager";
import { DailyInfo } from "../../model/DailyInfo";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
//class WalkthroughTip
    
    export  class WalkthroughTip /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            this.graphics.beginFill(16711680, 0);
            this.graphics.drawRect(0, 0, 265, 25);
            this.graphics.endFill();
            this.buttonMode = true;
            this.useHandCursor = true;
            ToolTipsManager.register(this);
            this.addEventListener(flash.events.MouseEvent.CLICK, this.onClickHandler);
            return;
        }

        public get toolTipData()
        {
            return this._toolTipData;
        }

        public set toolTipData(arg1)
        {
            this._toolTipData = arg1;
            return;
        }

        public set dailyInfo(arg1: DailyInfo)
        {
            var loc1=null;
            this._dailyInfo = arg1;
            if (this._dailyInfo.des.length > 24) 
            {
                loc1 = this._dailyInfo.des.substring(0, 24) + "\n" + this._dailyInfo.des.substring(24);
            }
            else 
            {
                loc1 = this._dailyInfo.des;
            }
            if (loc1 == "") 
            {
                this._toolTipData = null;
            }
            else 
            {
                this._toolTipData = HTMLUtil.addColor(loc1, "#ffffff");
            }
            return;
        }

        /* internal  */onClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._dailyInfo) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.DailyActiveGoTo, this._dailyInfo));
            }
            return;
        }

        /* internal */ /* var */_dailyInfo: DailyInfo;

        /* internal */ /* var */_toolTipData;
    }
